package com.nanyang.tms.manager.test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Component;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;

import com.nanyang.tms.dao.saleprice.SalePartDao;
import com.nanyang.tms.domain.saleprice.SalePartDO;
@Component("aManager")
public class AManagerImpl implements AManager{
	@Autowired
    private SalePartDao salePartDao;
	@Autowired
	DataSourceTransactionManager dataSourceTransactionManager;
	@Autowired
	TransactionDefinition transactionDefinition;
	@Override
	public void saveA(TransactionStatus transactionStatus) {
		SalePartDO salePartDO=new SalePartDO();
		salePartDO.setPartCode("3434343434");
		salePartDO.setPartName("sdsdsds");
		salePartDO.setPartSchemeCode("sdsdsdsdsd");
		salePartDO.setGmtCreatePin("sdsd");
		salePartDO.setGmtModifiedPin("sdsds");
		salePartDO.setIp("sdsdssdsd");
		try {
			salePartDao.insert(salePartDO);
		} catch (Exception e) {
			dataSourceTransactionManager.rollback(transactionStatus);
			throw e;
		}
		dataSourceTransactionManager.commit(transactionStatus);//提交
	}

}
